#!/bin/sh

. $LKP_SRC/lib/common.sh
. $LKP_SRC/lib/reproduce-log.sh

export PATH=$BENCHMARK_ROOT/filebench/bin:$PATH

task=$(cat /$TMP_RESULT_ROOT/filebench.task)
[ -n "$task" ] || {
        echo "filebench task file isn't setup properly!" >&2
        exit 1
}

$task
exit_status=$?

# Sleep to wait for nfs to complete the write. The 100s is chosen to be longer than
# the common nfs grace period (90 seconds). This can avoid rm failure when cleaning
# up the test data.
log_cmd sleep 100

mntpoint=${mount_points%% *}
# Remove all files/directories created by test
ls -d ${mntpoint:?}/*
log_cmd rm -rf ${mntpoint:?}/*

exit $exit_status
